<template>
	<view class="detail">
		<i-card top="20rpx">
			<view class="title">
				<image v-if="pageData.status === '10000003'" src="../../static/images/success_icon.png" mode=""></image>
				<image v-if="pageData.status === '10000004'" src="../../static/images/fail_icon.png" mode=""></image>
				<image v-if="pageData.status === '10000002' ||pageData.status === '10000001'" src="../../static/images/wait_icon.png" mode=""></image>
				<text>{{approval_state_type[pageData.status]}}</text>
			</view>
			<i-orderItem title="提现金额" :content="'￥'+pageData.amount"></i-orderItem>
			<i-orderItem title="提现渠道" v-if="pageData.type" :content="pageData.type"></i-orderItem>
			<i-orderItem title="提现渠道" v-else-if="pageData.bankName"  :content="pageData.bankName"></i-orderItem>
			<i-orderItem title="提现账号" v-if="pageData.account" :content="pageData.account"></i-orderItem>
			<i-orderItem title="提现账号" v-else-if="pageData.bankNo" :content="pageData.bankNo"></i-orderItem>
			<i-orderItem title="提现时间" :content="pageData.createTime"></i-orderItem>
			<i-orderItem v-if="pageData.status === '10000004'" :border="false" title="驳回原因" :content="pageData.remark || pageData.rejectReason"></i-orderItem>
		</i-card>
	</view>
</template>

<script lang="ts" setup>
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		getApiCashDetail,
		
	} from "../../api/user";
	import {
		getMerCashOrderDetail,
	} from "../../api/store";
	
	import {
		approval_state_type
	} from '../../utils/enums'
	import {
		ref
	} from 'vue';

	const pageData = ref<any>({})

	onLoad((option) => {
		if (option.orderId) {
			getDetail(option.orderId)
		} else {
			getData(option.cashOrderId)
		}
	})
	const getDetail = async(orderId: string) => {
		const {data} = await getApiCashDetail({
			orderId
		})
		pageData.value = data
	}
	const getData = async (cashOrderId : string) => {
		const data = await getMerCashOrderDetail({
			cashOrderId
		})
		pageData.value = data.data
		console.log(data, 'datadata');
	}
</script>

<style lang="scss" scoped>
	.detail {
		width: 100%;
		height: 100vh;
		overflow: hidden;
		background-color: $backColor;
		.title {
			@include flexCC;
			@include titlefont;
			margin-top: 30rpx;
			image {
				width: 120rpx;
				height: 120rpx;
				margin-bottom: 20rpx;
			}
		}
	}
</style>
